package com.justgame.project.service.just.controller.form;

import java.util.function.Consumer;
import com.justgame.project.cloud.common.query.Query;
import com.justgame.project.service.just.entity.JustGameCompany;
import com.justgame.project.service.just.query.JustGameCompanyQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import lombok.Data;

/**
*
* 游戏发行方信息控制器查询入参传输层
*
* @tableName just_game_company
* @author Zwb
* @since 2023-02-10
*/
@Data
@ApiModel(value="JustGameCompany对象传输层", description="游戏发行方信息传输层")
public class JustGameCompanyQueryForm{
    @ApiModelProperty("分页：页数")
    private Integer page;
    @ApiModelProperty("分页：条数")
    private Integer size;

    public Consumer<MPJLambdaWrapper<JustGameCompany>> buildCondition(){
        return wrapper -> {
        };
    }

    public JustGameCompanyQuery.Select buildSelect(){
        return JustGameCompanyQuery.Select.builder()
                    .JustGameCompany()
                    .createUser()
                    .updateUser()
                    .build();
    }

    public Page<JustGameCompany> buildPage(){
        return new Page<>(Math.max(page,1),Math.max(size,1));
    }

    public JustGameCompanyQuery buildListQuery(){
        return JustGameCompanyQuery.builder()
                .select(buildSelect().getQueriesArray())
                .condition(buildCondition());
    }

    public JustGameCompanyQuery buildPageQuery(){
        return buildListQuery().page(buildPage());
    }
}
